//
//  BaseView.m
//  OMHWatch
//
//  Created by dllo on 15/9/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "BaseView.h"

@interface BaseView ()

@property (nonatomic, assign) id target;//让谁去执行方法
@property (nonatomic, assign) SEL action;//执行的方法

@end

@implementation BaseView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imgaeview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        [self addSubview:self.imgaeview];
    }
    return self;
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    //让目标实现(点击)执行的方法
    [self.target performSelector:self.action withObject:self];
}

-(void)addTarget:(id)target selector:(SEL)selector
{
    self.action =selector;
    self.target =target;
}

@end
